#ifndef _OBJECT_H_
#define _OBJECT_H_

#include "vertex.h"
#include "vector.h"
#include "colour.h"
#include "ray.h"
#include "hit.h"
#include "colour.h"
#include "material.h"
#include "../my/include/transform.h"
#include "../my/include/Matrix.h"
#include <string>

#include <stack>

typedef struct {
     unsigned char red,green,blue;
} PPMPixel;

typedef struct {
     int x, y;
     PPMPixel *data;
} PPMImage;


class Object {
	Object *obj_next;
	std::stack<Transform> trans;//add by wang ping

public:
	int transformed = 0;

	std::string typex;
	int typei = 999;//object type, triangle=3, plane=1111, quadric=4 sphere=0

	double refraction = 99999.0;


	Material *obj_mat;

	Matrix invers_matrix;
	Matrix invers_matrix_T;

	Object(void);
	void link(Object *obj);
	Object *next(void);
	void setMaterial(Material *m);
	Colour getColour();
	virtual bool intersect(Ray &ray, Hit *h) {
		return false;
	}
	virtual bool sintersect(Ray &ray, Hit *h, double tl);

	void addTransform(Transform &tan);
	int needChangeNormal(Vector &light);

};

#endif
